<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Vue</title>
    <link rel="stylesheet" href="/css/common.css">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
</head><body><div id="app"><h2>{{nickname}}</h2></div><button onclick="app.$destroy()">销毁实例</button>
<script type="text/javascript">
    const app = new Vue({
        el: '#app',
        data: {
            nickname: 'Jim'
        },
        beforeCreate: function () {
            console.log('beforeCreate')
        },
        created: function () {
            console.log('created')
        },
        beforeMount: function () {
            console.log('beforeMount')
            window.setTimeout(() => {
                this.nickname = 'Babala'
            })
        },
        mounted: function () {
            console.log('mounted')
        },
        beforeUpdate: function () {
            console.log('beforeUpdate')
        },
        updated: function () {
            console.log('updated')
        },
        beforeDestroy: function () {
            console.log('beforeDestroy')
        },
        destroyed: function () {
            console.log('destroyed')
        }
    })
</script></body></html>
